package com.method;

/*
要写注释哦!!!
*/
public class Demo11 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6};
        int[] resout = rtnumber(arr);
        System.out.println("最大值为：" + resout[0]);
        System.out.println("最小值为：" + resout[1]);
    }

    public static int[] rtnumber(int[] arr) {
        int max = arr[0];
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (arr[i] < min) {
                min = arr[i];
            }
        }
        int[] newarr = {max, min};
        return newarr;
    }
}
